package com.example.holes;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;

public class CoinCounter {
	Paint paint = new Paint();
	Bitmap image;
	int coins;
	String coinsText;
	private final int left = (int)(689	 * Global.SCALE_RATIO_W);
	private final int top = (int)(12 * Global.SCALE_RATIO_H);
	private final int textLeft = (int)(760 * Global.SCALE_RATIO_W);
	private final int textTop = (int)(40 * Global.SCALE_RATIO_H);
	private final int right;
	private final int bottom;
	
	public CoinCounter(int coins, Bitmap image){
		this.coins = coins;
		coinsText = Integer.toString(coins);
		this.image = image;
		this.right = left + image.getWidth();
		this.bottom = top + image.getHeight();
		
		paint.setColor(Color.BLACK);
		paint.setTextSize(25);
		paint.setTextAlign(Align.RIGHT);
	}
	
	public void Draw(Canvas c){
		c.drawBitmap(image, left, top, null);
		c.drawText(coinsText, textLeft, textTop, paint);
	}
	
	public void plus(int num){
		coins += num;
		coinsText = Integer.toString(coins);
	}
	public int getCoins(){ return coins; }
}
